﻿using System;
using ClientOverflow.DataTransferObjects;
using ClientOverflow.ViewModels.QuestionsListViewModels;

namespace ClientOverflow.ViewModels.UserProfileViewModels
{
    /// <summary>
    /// Filters questions by the question tags.
    /// </summary>
    internal class TagQuestionsFilter : IQuestionsFilter
    {
        private readonly Tag tag;

        public TagQuestionsFilter(Tag tag)
        {
            this.tag = tag;
        }

        public bool IsFittingCrieteria(Question questionToFiler)
        {
            return IsTaggedQuestion(questionToFiler);
        }

        private bool IsTaggedQuestion(Question questionToFiler)
        {
            return questionToFiler.Tags.Contains(tag);
        }
    }
}